package com.powernode.common.filter;

import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import java.io.IOException;

@Component
public class SecurityFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        //从请求头中获取令牌

        //判断令牌是否为空

        //获取token

        //判断redis中是否存在token

        //获取安全对象

        //从安全对象中拿到权限集合

        //将权限集合放入请求中

        //将安全对象以及权限放入请求中

        //放行

    }
}
